<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
     const p1 = new Promise((resolve,reject)=>{

        try{
            console.log('请求123数据');
            // throw new Error('你已经错了')
            setTimeout(()=>{
                console.log('ni成功移交');
                resolve({
                    name: "1234"
                })
            },2000)
        }catch(e){
              reject(e.message)
        }
     })   
     p1.then((value)=>{
        console.log("成功", value);
     }),()=>{
        console.log("失败", reason);
     }
    </script>
</body>
</html>